var List = []
import Mock from 'mockjs'
for (var i = 0; i < 20; i++) {
    List.push({
        id: Mock.mock('@guid'),
        unit: Mock.mock('@integer(1, 4)'), // 1交警一大队 2交警二大队 3交警三大队 4 交警四大队
        date: Mock.mock('@datetime("2022.05.dd")'),
        dates: Mock.mock('@datetime("2022.05.dd HH:mm")'),
        address: Mock.mock('@county()'),
        road: Mock.mock('@integer(1, 2)'), // 1正常 2拥堵  
    })
}

import { param2Obj } from '../utls/utlsDemo'
export default {
    getBackstageData: (config) => {
        console.log(config);
        var { keyword } =param2Obj(config.url)
       var newARr = List.filter(item=>item.date.indexOf(keyword)!=-1)
        return {

            code: 200,
            msg: '请求成功',
            data: newARr
        }
    },
    deleteData: (config) => {
        var id = JSON.parse(config.body).id
        // console.log(id);
        List.forEach((item, index) => {
            if (item.id == id) {
                List.splice(index, 1)
            }
        })
        return {
            code: 200,
            msg: '删除成功',
            data: null
        }
    }
}